//! Copyright 2013 Virtium Technology, Inc.
//! All rights reserved
//!
#ifndef __CommCommand_h__
#define __CommCommand_h__

#include "BasicType.h"

#define COMMAND_BUFF_LENGTH_MAX     32

class cCommCommand
{
public:

    typedef enum
    {
		SEND_PENDING,
        SEND_PROCESSING,
        SEND_DONE,

        RECEIVE_PROCESSING,
        RECEIVE_DONE,
		RECEIVE_TIMEOUT,
        RECEIVE_OVERFLOW,
	} eStatus;


    typedef struct tag_sData
    {
        U32         Length;
        U8          Buff[COMMAND_BUFF_LENGTH_MAX];
		U8			Operation;
        eStatus Status;
        bool        CmdDone;
    } sData;

    sData m_Data;

    inline void SetStatus(eStatus iStatus)
    {
        m_Data.Status = iStatus;
    }

    inline eStatus GetStatus()
    {
        return (m_Data.Status);
    }

    inline void SetCmdDone(bool iCmdStatus)
    {
        m_Data.CmdDone = iCmdStatus;
    }

    inline bool IsCmdDone()
    {
        return (m_Data.CmdDone);
    }

    inline bool CopyData(U8* iBuff, U16 iLen)
    {
        if (COMMAND_BUFF_LENGTH_MAX < iLen) return (false);
        
        m_Data.Length = iLen;
        for (U16 i = 0; i < iLen; i++)
        {
            m_Data.Buff[i] = iBuff[i];
        }
        return (true);
    }
};

#endif // __CommCommand_h__
